package C;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;


public class C22 {
    static class Rect{
        private int minL = Integer.MAX_VALUE;
        private int maxL = Integer.MIN_VALUE;
        private int minC = Integer.MAX_VALUE;
        private int maxC = Integer.MIN_VALUE;

        public void setL(int l) {
            this.minL = Math.min(minL,l);
            this.maxL = Math.max(maxL,l);
        }
        public void setC(int c) {
            this.minC = Math.min(minC,c);
            this.maxC = Math.max(maxC,c);
        }
    }


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int c = sc.nextInt();
        HashMap<Integer,Rect> map = new HashMap<>();
        for (int i=0;i<l;i++) {
            for (int j=0;j<c;j++) {
                int num = sc.nextInt();
                if (num!=0) {
                    map.putIfAbsent(num, new Rect());
                    map.get(num).setL(i);
                    map.get(num).setC(j);
                }
            }
        }

        int area = Integer.MIN_VALUE;
        for (Rect rect: map.values()) {
            area = Math.max(area, (rect.maxL-rect.minL+1)*(rect.maxC-rect.minC+1));
            System.out.println("maxL="+rect.maxL+
                    "minL="+rect.minL+"maxC="+ rect.maxC+"minC="+ rect.minC+"area="+area);

        }
        System.out.println(area);
    }
}
